import http from "./http";
import config from "./config"
var _ = require('lodash');

class appMain {
    constructor() {
        this.jsonHeader = {
            'content-type': "application/json"
        }
        this.uploadHeadr = {
            'content-type': "multipart/form-data"
        }
    }


    //登录
    login(params) {
        let url = config.url.login;
        return http.post(url, params)
    }

    logout() {
        let url = config.url.logout;
        return http.post(url, {})
    }
    loadApply() {
        let url = config.url.loadApply;
        return http.get(url, {})
    }

    /**
     * 请求，第二个参数表示是否加到url后面的参数(/param)
     */
    // 人事-人事档案
    getUser(params) {
        let url = config.url.getUser
        return http.get(url, params)
    }
    employeeInsert(params) {
        let url = config.url.employeeInsert;
        return http.post(url, params)
    }
    employeeFindAllPageByDTO(params) {
        let url = config.url.employeeFindAllPageByDTO;
        return http.post(url, params)
    }
    updateEmployeeById(params) {
        let url = config.url.updateEmployeeById;
        return http.put(url, params)
    }
    findEmployeeById(params, urlparam) {
        let url = config.url.findEmployeeById + urlparam;
        return http.get(url, params);
    }
    delEmployee(params, urlparam) {
        let url = config.url.delEmployee + urlparam;
        return http.delete(url, params);
    }
    // 人事-人事合同
    contractFindAllPageByDTO(params) {
        let url = config.url.contractFindAllPageByDTO;
        return http.post(url, params)
    }
    contractInsert(params) {
        let url = config.url.contractInsert;
        return http.post(url, params)
    }
    contractUpdateById(params) {
        let url = config.url.contractUpdateById;
        return http.put(url, params)
    }
    contractFindById(params, urlparam) {
        let url = config.url.contractFindById + urlparam;
        return http.get(url, params);
    }
    contractDelById(params, urlparam) {
        let url = config.url.contractDelById + urlparam;
        return http.delete(url, params);
    }

    //人事-离职
    resignationInsert(params) {
        let url = config.url.resignationInsert;
        return http.post(url, params)
    }
    resignationFindAllPageByDTO(params) {
        let url = config.url.resignationFindAllPageByDTO;
        return http.post(url, params)
    }
    resignationUpdateById(params) {
        let url = config.url.resignationUpdateById;
        return http.put(url, params)
    }
    resignationFindById(params, urlparam) {
        let url = config.url.resignationFindById + urlparam;
        return http.get(url, params);
    }
    resignationDelById(params, urlparam) {
        let url = config.url.resignationDelById + urlparam;
        return http.delete(url, params);
    }

    //人事-转正管理
    correntInsert(params) {
        let url = config.url.correntInsert;
        return http.post(url, params)
    }
    correntFindAllPageByDTO(params) {
        let url = config.url.correntFindAllPageByDTO;
        return http.post(url, params)
    }
    correntUpdateById(params) {
        let url = config.url.correntUpdateById;
        return http.put(url, params)
    }
    correntFindById(params, urlparam) {
        let url = config.url.correntFindById + urlparam;
        return http.get(url, params);
    }
    correntDelById(params, urlparam) {
        let url = config.url.correntDelById + urlparam;
        return http.delete(url, params);
    }

    //人事-人事调动
    transferInsert(params) {
        let url = config.url.transferInsert;
        return http.post(url, params)
    }
    transferFindAllPageByDTO(params) {
        let url = config.url.transferFindAllPageByDTO;
        return http.post(url, params)
    }
    transferUpdateById(params) {
        let url = config.url.transferUpdateById;
        return http.put(url, params)
    }
    transferFindById(params, urlparam) {
        let url = config.url.transferFindById + urlparam;
        return http.get(url, params);
    }
    transferDelById(params, urlparam) {
        let url = config.url.transferDelById + urlparam;
        return http.delete(url, params);
    }
    //人事-员工福利
    welfareInsert(params) {
        let url = config.url.welfareInsert;
        return http.post(url, params)
    }
    welfareFindAllPageByDTO(params) {
        let url = config.url.welfareFindAllPageByDTO;
        return http.post(url, params)
    }
    welfareUpdateById(params) {
        let url = config.url.welfareUpdateById;
        return http.put(url, params)
    }
    welfareFindById(params, urlparam) {
        let url = config.url.welfareFindById + urlparam;
        return http.get(url, params);
    }
    welfareDelById(params, urlparam) {
        let url = config.url.welfareDelById + urlparam;
        return http.delete(url, params);
    }
    //人事-证件
    credentialsInsert(params) {
        let url = config.url.credentialsInsert;
        return http.post(url, params)
    }
    credentialsFindAllPageByDTO(params) {
        let url = config.url.credentialsFindAllPageByDTO;
        return http.post(url, params)
    }
    credentialsUpdateById(params) {
        let url = config.url.credentialsUpdateById;
        return http.put(url, params)
    }
    credentialsFindById(params, urlparam) {
        let url = config.url.credentialsFindById + urlparam;
        return http.get(url, params);
    }
    credentialsDelById(params, urlparam) {
        let url = config.url.credentialsDelById + urlparam;
        return http.delete(url, params);
    }
    //人事-考核模板

    assessmentTemplateInsert(params) {
        let url = config.url.assessmentTemplateInsert;
        return http.post(url, params)
    }
    assessmentTemplateFindAllPageByDTO(params) {
        let url = config.url.assessmentTemplateFindAllPageByDTO;
        return http.post(url, params)
    }
    assessmentTemplateUpdateById(params) {
        let url = config.url.assessmentTemplateUpdateById;
        return http.put(url, params)
    }
    assessmentTemplateFindById(params, urlparam) {
        let url = config.url.assessmentTemplateFindById + urlparam;
        return http.get(url, params);
    }
    assessmentTemplateBytemplateTypeId(params) {
        let url = config.url.assessmentTemplateBytemplateTypeId;
        return http.get(url, params);
    }
    assessmentTemplateDelById(params, urlparam) {
        let url = config.url.assessmentTemplateDelById + urlparam;
        return http.delete(url, params);
    }

    //人事-考核
    assessmentKaoheInsert(params) {
        let url = config.url.assessmentKaoheInsert;
        return http.post(url, params)
    }
    assessmentKaoheFindAllPageByDTO(params) {
        let url = config.url.assessmentKaoheFindAllPageByDTO;
        return http.post(url, params)
    }
    assessmentKaoheUpdateById(params) {
        let url = config.url.assessmentKaoheUpdateById;
        return http.put(url, params)
    }
    assessmentKaoheFindById(params, urlparam) {
        let url = config.url.assessmentKaoheFindById + urlparam;
        return http.get(url, params);
    }
    assessmentKaoheDelById(params, urlparam) {
        let url = config.url.assessmentKaoheDelById + urlparam;
        return http.delete(url, params);
    }







    // 基本资料管理
    dictTypeFindAllPageByTypeName(params) {
        let url = config.url.dictTypeFindAllPageByTypeName;
        return http.post(url, params)
    }
    // dictTypeInsert(params) {
    //     let url = config.url.dictTypeInsert;
    //     return http.post(url, params)
    // }
    // dictTypeUpdateById(params) {
    //     let url = config.url.dictTypeUpdateById;
    //     return http.delete(url, params);
    // }
    // dictTypeDeleById(params, urlparam) {
    //     let url = config.url.dictTypeDeleById + urlparam;
    //     return http.delete(url, params);
    // }
    dictItemDictTypeId(params) {
        let url = config.url.dictItemDictTypeId;
        return http.get(url, params);
    }
    dictItemInsert(params) {
        let url = config.url.dictItemInsert;
        return http.post(url, params)
    }
    dictItemUpdateItemName(params) {
        let url = config.url.dictItemUpdateItemName;
        return http.put(url, params)
    }
    dictItemDel(params, urlparam) {
        let url = config.url.dictItemDel + urlparam;
        return http.delete(url, params);
    }

    // 客户管理-客户信息
    clientInfoFindAllNo(params) {
        let url = config.url.clientInfoFindAllNo;
        return http.post(url, params);
    }
    clientInfoFindAllPageByDTO(params) {
        let url = config.url.clientInfoFindAllPageByDTO;
        return http.post(url, params);
    }
    clientInfoInsert(params) {
        let url = config.url.clientInfoInsert;
        return http.post(url, params)
    }
    clientInfoUpdateById(params) {
        let url = config.url.clientInfoUpdateById;
        return http.put(url, params)
    }
    clientInfoFindById(params, urlparam) {
        let url = config.url.clientInfoFindById + urlparam;
        return http.get(url, params);
    }
    clientInfoDel(params, urlparam) {
        let url = config.url.clientInfoDel + urlparam;
        return http.delete(url, params);
    }
    // 客户管理-自定义客户属性
    customFieldGetAllField(params) {
        let url = config.url.customFieldGetAllField;
        return http.get(url, params);
    }
    customFieldInsert(params) {
        let url = config.url.customFieldInsert;
        return http.post(url, params);
    }
    customFieldUpdateById(params) {
        let url = config.url.customFieldUpdateById;
        return http.put(url, params);
    }
    customFieldFindById(params, urlparam) {
        let url = config.url.customFieldFindById + '/' + urlparam;
        return http.get(url, params);
    }
    customFieldDel(params, urlparam) {
        let url = config.url.customFieldDel + '/' + urlparam;
        return http.delete(url, params);
    }
    // 客户管理-区域管理
    regionInfoFindAllPageByName(params) {
        let url = config.url.regionInfoFindAllPageByName;
        return http.post(url, params);
    }
    // 客户管理-客户分配
    customerAllocationInfoFindAllPageByDTO(params) {
        let url = config.url.customerAllocationInfoFindAllPageByDTO;
        return http.post(url, params);
    }
    customerAllocationInfoInsert(params) {
        let url = config.url.customerAllocationInfoInsert;
        return http.post(url, params);
    }
    customerAllocationInfoUpdateById(params) {
        let url = config.url.customerAllocationInfoUpdateById;
        return http.put(url, params);
    }
    customerAllocationInfoFindById(params, urlparam) {
        let url = config.url.customerAllocationInfoFindById + urlparam;
        return http.get(url, params);
    }
    customerAllocationInfoDel(params, urlparam) {
        let url = config.url.customerAllocationInfoDel + urlparam;
        return http.delete(url, params);
    }
    // 客户管理-联系记录
    customerLinkInfoFindAllPageByDTO(params) {
        let url = config.url.customerLinkInfoFindAllPageByDTO;
        return http.post(url, params);
    }
    customerLinkInfoInset(params) {
        let url = config.url.customerLinkInfoInset;
        return http.post(url, params);
    }
    customerLinkInfoUpdateById(params) {
        let url = config.url.customerLinkInfoUpdateById;
        return http.put(url, params);
    }
    customerLinkInfoFindById(params, urlparam) {
        let url = config.url.customerLinkInfoFindById + urlparam;
        return http.get(url, params);
    }
    customerLinkInfoDel(params, urlparam) {
        let url = config.url.customerLinkInfoDel + urlparam;
        return http.delete(url, params);
    }
    // 客户管理-礼品关怀
    giftInfoFindAllPageByDTO(params) {
        let url = config.url.giftInfoFindAllPageByDTO;
        return http.post(url, params);
    }
    giftInfoInsert(params) {
        let url = config.url.giftInfoInsert;
        return http.post(url, params);
    }
    giftInfoUpdateById(params) {
        let url = config.url.giftInfoUpdateById;
        return http.put(url, params);
    }
    giftInfoFindById(params, urlparam) {
        let url = config.url.giftInfoFindById + urlparam;
        return http.get(url, params);
    }
    giftInfoDel(params, urlparam) {
        let url = config.url.giftInfoDel + urlparam;
        return http.delete(url, params);
    }
    // 客户管理-客户合同
    clientContractInfoFindAllPageByDTO(params) {
        let url = config.url.clientContractInfoFindAllPageByDTO;
        return http.post(url, params);
    }
    clientContractInfoInsert(params) {
        let url = config.url.clientContractInfoInsert;
        return http.post(url, params);
    }
    clientContractInfoUpdateById(params) {
        let url = config.url.clientContractInfoUpdateById;
        return http.put(url, params);
    }
    clientContractInfoFindById(params, urlparam) {
        let url = config.url.clientContractInfoFindById + urlparam;
        return http.get(url, params);
    }
    clientContractInfoDel(params, urlparam) {
        let url = config.url.clientContractInfoDel + urlparam;
        return http.delete(url, params);
    }
    // 客户管理-收款计划管
    collectMoneyPlanFindAllPageByDTO(params) {
        let url = config.url.collectMoneyPlanFindAllPageByDTO;
        return http.post(url, params);
    }
    collectMoneyPlanInsert(params) {
        let url = config.url.collectMoneyPlanInsert;
        return http.post(url, params);
    }
    collectMoneyPlanUpdateById(params) {
        let url = config.url.collectMoneyPlanUpdateById;
        return http.put(url, params);
    }
    collectMoneyPlanFindById(params, urlparam) {
        let url = config.url.collectMoneyPlanFindById + urlparam;
        return http.get(url, params);
    }
    collectMoneyPlanDel(params, urlparam) {
        let url = config.url.collectMoneyPlanDel + urlparam;
        return http.delete(url, params);
    }
    // 客户管理-发票信息
    billingInfoFindAllPageByDTO(params) {
        let url = config.url.billingInfoFindAllPageByDTO;
        return http.post(url, params);
    }
    billingInfoInsert(params) {
        let url = config.url.billingInfoInsert;
        return http.post(url, params);
    }
    billingInfoUpdateById(params) {
        let url = config.url.billingInfoUpdateById;
        return http.put(url, params);
    }
    billingInfoFindById(params, urlparam) {
        let url = config.url.billingInfoFindById + urlparam;
        return http.get(url, params);
    }
    billingInfoDel(params, urlparam) {
        let url = config.url.billingInfoDel + urlparam;
        return http.delete(url, params);
    }
    //  客户管理-区域管理
    regionInfoFindAllPageByName(params) {
        let url = config.url.regionInfoFindAllPageByName;
        return http.post(url, params);
    }
    regionInfoInsert(params) {
        let url = config.url.regionInfoInsert;
        return http.post(url, params);
    }
    regionInfoUpdateById(params) {
        let url = config.url.regionInfoUpdateById;
        return http.put(url, params);
    }
    regionInfoDel(params, urlparam) {
        let url = config.url.regionInfoDel + urlparam;
        return http.delete(url, params);
    }
    // 客户管理-往来单位类别
    clientTypeTypeTree(params) {
        let url = config.url.clientTypeTypeTree;
        return http.get(url, params);
    }
    clientTypeInsert(params) {
        let url = config.url.clientTypeInsert;
        return http.post(url, params);
    }
    clientTypeUpdateById(params) {
        let url = config.url.clientTypeUpdateById;
        return http.put(url, params);
    }
    clientTypeFindById(params, urlparam) {
        let url = config.url.clientTypeFindById + urlparam;
        return http.get(url, params);
    }
    clientTypeDel(params, urlparam) {
        let url = config.url.clientTypeDel + urlparam;
        return http.delete(url, params);
    }




    //组织机构-组织机构
    organizationList() {
        let url = config.url.organizationList;
        return http.get(url, {});
    }
    organizationUserList() {
        let url = config.url.organizationUserList;
        return http.get(url, {});
    }
    organizationUserListByOrgId(param, urlparam) {
        let url = config.url.organizationUserListByOrgId + urlparam;
        return http.get(url, {});
    }

    organizationInsert(param) {
        let url = config.url.organizationInsert;
        return http.post(url, param);
    }
    organizationUpdateById(param) {
        let url = config.url.organizationUpdateById;
        return http.put(url, param);
    }
    organizationDelById(param, urlparam) {
        let url = config.url.organizationDelById + urlparam;
        return http.delete(url, {});
    }

    //岗位
    jobInfoInsert(params) {
        let url = config.url.jobInfoInsert;
        return http.post(url, params)
    }
    jobInfoFindAllPageByDTO(params) {
        let url = config.url.jobInfoFindAllPageByDTO;
        return http.post(url, params)
    }
    jobInfoUpdateById(params) {
        let url = config.url.jobInfoUpdateById;
        return http.put(url, params)
    }
    jobInfoFindById(params, urlparam) {
        let url = config.url.jobInfoFindById + urlparam;
        return http.get(url, params);
    }
    jobInfoDel(params, urlparam) {
        let url = config.url.jobInfoDel + urlparam;
        return http.delete(url, params);
    }
    //角色
    roleInsert(params) {
        let url = config.url.roleInsert;
        return http.post(url, params)
    }
    roleFindAllPageByDTO(params) {
        let url = config.url.roleFindAllPageByDTO;
        return http.post(url, params)
    }
    roleUpdateById(params) {
        let url = config.url.roleUpdateById;
        return http.put(url, params)
    }
    roleFindById(params, urlparam) {
        let url = config.url.roleFindById + urlparam;
        return http.get(url, params);
    }
    roleDel(params, urlparam) {
        let url = config.url.roleDel + urlparam;
        return http.delete(url, params);
    }
    //权限
    permissionFind(params) {
        let url = config.url.permissionFind;
        return http.get(url, params);
    }
    permissionFindModules(params) {
        let url = config.url.permissionFindModules;
        return http.get(url, params);
    }
    updatePermissionsByModuleId(params) {
        let url = config.url.updatePermissionsByModuleId;
        return http.put(url, params);
    }
    //用户账号
    accountInsert(params) {
        let url = config.url.accountInsert;
        return http.post(url, params)
    }
    accountFindPageList(params) {
        let url = config.url.accountFindPageList;
        return http.post(url, params)
    }
    accountFindAll(params) {
        let url = config.url.accountFindAll;
        return http.get(url, params)
    }
    accountUpdateById(params) {
        let url = config.url.accountUpdateById;
        return http.put(url, params)
    }
    accountFindById(params, urlparam) {
        let url = config.url.accountFindById + urlparam;
        return http.get(url, params);
    }
    accountModify(params, urlparam) {
        let url = config.url.accountModify + urlparam;
        return http.put(url, params)
    }



    //文件
    //文件附件
    uploadFileInfoFindById(params, urlparam) {
        let url = config.url.uploadFileInfoFindById + urlparam;
        return http.get(url, {});
    }

    // 根据字典名称,获取字典项列表,用于下拉框
    dictItem(params) {
        let url = config.url.dictItem;
        return http.post(url, params)
    }
    dictItem(params) {
        console.log('dictItem', params)
        let url = config.url.dictItem;
        return http.post(url, params)
    }

    // 秒用系统基础数据
    provinceFindAll(params) {
        let url = config.url.provinceFindAll;
        return http.get(url, params)
    }
    cityFindAll(params) {
        let url = config.url.provinceFindAll;
        return http.get(url, params)
    }
    cityFindList(params) {
        let url = config.url.cityFindList;
        return http.post(url, params)
    }
    areaFindAll(params) {
        let url = config.url.provinceFindAll;
        return http.get(url, params)
    }
    areaFindList(params) {
        let url = config.url.areaFindList;
        return http.post(url, params)
    }

    //财务
    //科目分类
    subjectCategoryFindAll(params) {
        let url = config.url.subjectCategoryFindAll;
        return http.get(url, params)
    }
    subjectCategoryFindById(params, urlparam) {
        let url = config.url.subjectCategoryFindById + urlparam;
        return http.get(url, {})
    }
    //科目管理
    subjectGetAllTypeTree(params) {
        let url = config.url.subjectGetAllTypeTree;
        return http.post(url, params)
    }
    subjectGetTreeByType(params, urlparam) {
        let url = config.url.subjectGetTreeByType + urlparam;
        return http.post(url, {})
    }
    subjectInsert(params) {
        let url = config.url.subjectInsert;
        return http.post(url, params)
    }
    subjectUpdateById(params) {
        let url = config.url.subjectUpdateById;
        return http.post(url, params)
    }
    subjectDelById(params, urlparam) {
        let url = config.url.subjectDelById + urlparam;
        return http.post(url, {})
    }
    subjectFindById(params, urlparam) {
        let url = config.url.subjectFindById + urlparam;
        return http.get(url, {})
    }


    //汇率
    currRateInsert(params) {
        let url = config.url.currRateInsert;
        return http.post(url, params)
    }
    currRateFindAllPage(params) {
        let url = config.url.currRateFindAllPage;
        return http.post(url, params)
    }
    currRateUpdateById(params) {
        let url = config.url.currRateUpdateById;
        return http.post(url, params)
    }

    currRateDelById(params, urlparam) {
        let url = config.url.currRateDelById + urlparam;
        return http.delete(url, {})
    }
    currRateFindById(params, urlparam) {
        let url = config.url.currRateFindById + urlparam;
        return http.get(url, {})
    }
    currRateFindList(params) {
        let url = config.url.currRateFindList;
        return http.post(url, params)
    }
    getByCurrCodeAndDate(params) {
        let url = config.url.getByCurrCodeAndDate;
        return http.post(url, params)
    }
    countLamount(params) {
        let url = config.url.countLamount;
        return http.post(url, params)
    }

    //币别
    currencyInsert(params) {
        let url = config.url.currencyInsert;
        return http.post(url, params)
    }
    currencyFindAllPage(params) {
        let url = config.url.currencyFindAllPage;
        return http.post(url, params)
    }
    currencyUpdateById(params) {
        let url = config.url.currencyUpdateById;
        return http.put(url, params)
    }
    currencyFindById(params, urlparam) {
        let url = config.url.currencyFindById + urlparam;
        return http.get(url, {})
    }
    currencyDelById(params, urlparam) {
        let url = config.url.currencyDelById + urlparam;
        return http.delete(url, {})
    }

    //会计期间
    accPeriodFindDefaultData(params) {
        let url = config.url.accPeriodFindDefaultData;
        return http.get(url, {})
    }
    accPeriodFindAllPage(params) {
        let url = config.url.accPeriodFindAllPage;
        return http.post(url, params)
    }

    accPeriodGenerate(params, urlparam) {
        let url = config.url.accPeriodGenerate + params + '/' + urlparam;
        return http.get(url, {})
    }
    accPeriodDel(params, urlparam) {
        let url = config.url.accPeriodDel + params + '/' + urlparam;
        return http.post(url, {})
    }
    accPeriodDefaultData(params, urlparam) {
        let url = config.url.accPeriodDefaultData + '/' + urlparam
        return http.get(url, params)
    }


    //单别设置
    orderNoRuleInsert(params) {
        let url = config.url.orderNoRuleInsert;
        return http.post(url, params)
    }
    orderNoRuleFindAllPage(params) {
        let url = config.url.orderNoRuleFindAllPage;
        return http.post(url, params)
    }
    orderNoRuleFindAll(params) {
        let url = config.url.orderNoRuleFindAll;
        return http.get(url, params)
    }
    orderNoRuleUpdateById(params) {
        let url = config.url.orderNoRuleUpdateById;
        return http.put(url, params)
    }
    orderNoRuleFindModelOfNo(params) {
        let url = config.url.orderNoRuleFindModelOfNo;
        return http.get(url, {})
    }
    orderNoRuleFindTask(params) {
        let url = config.url.orderNoRuleFindTask;
        return http.get(url, {})
    }
    orderNoRuleFindById(params, urlparam) {
        let url = config.url.orderNoRuleFindById + urlparam;
        return http.get(url, {})
    }

    //银行账户
    accBankInsert(params) {
        let url = config.url.accBankInsert;
        return http.post(url, params)
    }
    accBankFindAllPage(params) {
        let url = config.url.accBankFindAllPage;
        return http.post(url, params)
    }
    accBankUpdateById(params) {
        let url = config.url.accBankUpdateById;
        return http.post(url, params)
    }
    accBankFindById(params, urlparam) {
        let url = config.url.accBankFindById + urlparam;
        return http.get(url, {})
    }
    accBankDelById(params, urlparam) {
        let url = config.url.accBankDelById + urlparam;
        return http.delete(url, {})
    }

    // 财务-凭证管理
    bkpfInfoList(params) {
        let url = config.url.bkpfInfoList;
        return http.post(url, params)
    }
    bkpfInfoAddBkpfInfo(params) {
        let url = config.url.bkpfInfoAddBkpfInfo;
        return http.post(url, params)
    }
    bkpfInfoCancel(params, urlparam) {
        let url = config.url.bkpfInfoCancel + urlparam;
        return http.get(url, params)
    }
    bkpfInfoFindById(params, urlparam) {
        let url = config.url.bkpfInfoFindById + urlparam;
        return http.get(url, params)
    }
    bkpfInfoReview(params, urlparam) {
        let url = config.url.bkpfInfoReview + urlparam;
        return http.get(url, params)
    }
    bkpfInfoUpdateBkpfInfo(params) {
        let url = config.url.bkpfInfoUpdateBkpfInfo;
        return http.post(url, params)
    }
    bkpfInfoDel(params, urlparam) {
        let url = config.url.bkpfInfoDel + urlparam;
        return http.delete(url, params)
    }
    bkpfInfoPosting(params, urlparam) {
        let url = config.url.bkpfInfoPosting + urlparam;
        return http.get(url, params)
    }
    bkpfInfoUnposting(params, urlparam) {
        let url = config.url.bkpfInfoUnposting + urlparam;
        return http.get(url, params)
    }
    // 财务-总帐管理
    generalLedgerInfo(params, urlparam) {
        let url = config.url.generalLedgerInfo + urlparam;
        return http.get(url, params)
    }
    generalLedgerList(params) {
        let url = config.url.generalLedgerList;
        return http.post(url, params)
    }


    //账套
    setBooksInsert(params) {
        let url = config.url.setBooksInsert;
        return http.post(url, params)
    }
    setBooksFindAllPage(params) {
        let url = config.url.setBooksFindAllPage;
        return http.post(url, params)
    }
    setBooksFindAll(params) {
        let url = config.url.setBooksFindAll;
        return http.post(url, params)
    }
    setBooksUpdateById(params) {
        let url = config.url.setBooksUpdateById;
        return http.post(url, params)
    }

    setBooksDelById(params, urlparam) {
        let url = config.url.setBooksDelById + urlparam;
        return http.post(url, {})
    }
    setBooksFindById(params, urlparam) {
        let url = config.url.setBooksFindById + urlparam;
        return http.get(url, {})
    }

    //银行往来
    billBankDetailInsert(params) {
        let url = config.url.billBankDetailInsert;
        return http.post(url, params)
    }
    billBankDetailFindAllPage(params) {
        let url = config.url.billBankDetailFindAllPage;
        return http.post(url, params)
    }
    billBankDetailUpdateById(params) {
        let url = config.url.billBankDetailUpdateById;
        return http.post(url, params)
    }

    billBankDetailDelById(params, urlparam) {
        let url = config.url.billBankDetailDelById + urlparam;
        return http.delete(url, {})
    }

    billBankDetailFindById(params, urlparam) {
        let url = config.url.billBankDetailFindById + urlparam;
        return http.get(url, {})
    }
    billBankbkpf(params, urlparam) {
        let url = config.url.billBankbkpf + params + '/' + urlparam;
        return http.get(url, {})
    }
    // 时间补0
    formatZero(val) {
        if (val < 10) {
            return '0' + val
        }
        return val
    }
    // 时间格式化
    formatDate(date, fmt) {
        var date = new Date(date)
        if (/(y+)/.test(fmt)) {
            fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
        }
        let o = {
            'M+': date.getMonth() + 1,
            'd+': date.getDate(),
            'h+': date.getHours(),
            'm+': date.getMinutes(),
            's+': date.getSeconds()
        };
        for (let k in o) {
            if (new RegExp(`(${k})`).test(fmt)) {
                let str = o[k] + '';
                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : this.padLeftZero(str));
            }
        }
        return fmt;
    };

    padLeftZero(str) {
        return ('00' + str).substr(str.length);
    }

    base64ToFile(urlData, fileName) {
        let arr = urlData.split(',');
        let mime = arr[0].match(/:(.*?);/)[1];
        let bytes = atob(arr[1]); // 解码base64
        let n = bytes.length
        let ia = new Uint8Array(n);
        while (n--) {
            ia[n] = bytes.charCodeAt(n);
        }
        return new File([ia], fileName, {
            type: mime
        });
    }

    // 处理树结构数据data为数组
    dealTree(data) {
        let newData = [];

        function deal(d) {
            d.label = d.documentTypeName;
            d.children = _.cloneDeep(d.child)
            console.log(d.children)
            if (d.children !== null) {
                d.children.map((sitem) => {
                    deal(sitem)
                })
            }
        }
        data.map((item) => {
            deal(item)
        })
        return data;
    }
    // 判断是否数字 true:数值型的，false：非数值型
    myIsNaN(value) {
        return typeof value === 'number' && !isNaN(value);
    }
}
export default new appMain()